<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude">

  <!--<xi:include href="master.html" />-->

<head>
  <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
  <title>Test Reminder</title>
    <script src="/js/jquery.validate.js" type="text/javascript"></script>
    <script src="/js/jquery.form.js" type="text/javascript"></script>
<script type="text/javascript">/*<![CDATA[*/
$(document).ready(function(){
    $('#success').hide();
    $('#fail').hide();
});

function parseResponse(data) {
    var kw = data.kw
    var message = kw['message'];
    var event_id = kw['event_id'];
    var trigger = kw['trigger'];
    var users_involved = kw['users_involved'];
    var add_status = data.add_status;
    if (add_status == 'ok') { $('#flash').html('Thanks! That reminder was saved');
        }
    else if (add_status == 'fail') { $('#flash').html('Oops! That reminder was not saved');
        }
    else { return }

}

$.validator.setDefaults({
        submitHandler: function() {
            $("#reminder_form").ajaxSubmit();
        }
});

$().ready(function() {
    // don't validate groups_involved. If it is empty, then insert the current user in the controller
	$("#reminder_form").validate({
		rules: {
			message: "required",
            trigger: "required",
			},
		messages: {
			message: "The message field cannot be left empty",
            trigger: "The trigger field cannot be left empty",
		}
	});
 });

/*]]>*/
</script>
</head>

<body>
    <div id="flash"></div>
    <div id="init">${tmpl_context.reminder_form(value=dict(event_id=event.event_id,trigger='30'),child_args=dict(users_involved=dict(options=user_options)))}</div>
</body>
</html>
